package main

import (
	"fmt"
	/*引入misaka包*/
	"misakago"
	"os"
)

var Everyone int = 1
var Authenticated int = 1 << 1

func main() {
	/*创建服务器*/
	var server misakago.MisakaServer

	/*配置文件path使用环境变量*/
	configPath := os.Getenv("MISAKA_GO_CONFIG")

	if configPath == "" {
		fmt.Printf("configPath is empty, need env MISAKA_GO_CONFIG\n")
		return
	} else {
		fmt.Printf("configPath is %s\n", configPath)
	}

	/*设置加载的配置文件*/
	server.SetConfPath(configPath)
	/*页面测试接口*/
	server.AddRoute("/static-test", Everyone, misakago.StaticHandler("home.html"))
	/*api测试接口*/
	server.AddRoute("/api/echo", Everyone, echoHandler)
	/*消息板接口*/
	server.AddRoute("/", Everyone, MsgBoardHandler)
	/*开启服务*/
	server.StartServer()

}
